import * as mars3d from "mars3d"

export let map // mars3d.Map三维地图对象
let tilesetLayer

// 需要覆盖config.json中地图属性参数（当前示例框架中自动处理合并）
export const mapOptions = {
  scene: {
    center: { lat: 31.782242, lng: 117.198472, alt: 253.3, heading: 41.8, pitch: -34.5 }
  }
}

/**
 * 初始化地图业务，生命周期钩子函数（必须）
 * 框架在地图初始化完成后自动调用该函数
 * @param {mars3d.Map} mapInstance 地图对象
 * @returns {void} 无
 */
export function onMounted(mapInstance) {
  map = mapInstance // 记录map

  const graphicLayer = new mars3d.layer.GraphicLayer()
  map.addLayer(graphicLayer)

  tilesetLayer = new mars3d.layer.TilesetLayer({
    url: "//data.mars3d.cn/3dtiles/max-daqiao/tileset.json",
    position: { lat: 31.7843, lng: 117.196414, alt: -99 },
    rotation: { z: -4 },
    popup: "all"
  })
  map.addLayer(tilesetLayer)

  let len = 0
  const timeTik = setInterval(() => {
    len += 8
    if (len > showArr.length) {
      clearInterval(timeTik)
      return
    }

    const conditions = []
    for (let index = 0; index < len; index++) {
      const element = showArr[index]
      conditions.push(["${id} ==='" + element + "' ", "rgb(255, 255, 255)"])
    }
    conditions.push(["true", "rgba(255, 255, 255,0.03)"])

    tilesetLayer.style = new Cesium.Cesium3DTileStyle({
      color: {
        conditions: conditions
      }
    })
  }, 1000)

  // 还原或删除赋予的样式
  // setTimeout(() => {
  //   tilesetLayer.style = undefined
  // }, 5000)
}

/**
 * 释放当前地图业务的生命周期函数
 * @returns {void} 无
 */
export function onUnmounted() {
  map = null
}

const showArr = [
  "7edccc661418aeb5761dbcdc06ad490c",
  "5ac8bb8a7d745102a978c5f8ccdb61b8",
  "1102a326d5f7c9e04fc3c89d0ede88c9",
  "028ee724157b05d04e7bdcf237d12e60",
  "f8da71e562ff44a2bc7edf3578c593da",
  "a8aa681aaa4588a8dbd3b42b26d59a1a",
  "d89a66c7c80a29b1bdbab0f2a1a94af8",
  "e97c864e8ac67f7aed5ce53ec28638f5",
  "0bed45bd5774ffddc95ffe500024f628",
  "0e900ad84f63618452210ab8baae0218",
  "88fee0421317424e4469f33a48f50cb0",
  "a8345c3bb9e3896ea538ce77ffaf2c20",
  "5352696a9ca3397beb79f116f3a33991",
  "d79c6256b9bdac53a55801a066b70da3",
  "d8330f857a17c53d217014ee776bfd50",
  "0189caa552598b845b29b17a427692d1",
  "051928341be67dcba03f0e04104d9047",
  "23d2e1578544b172cca332ff74bddf5f",
  "d198bd736a97e7cecfdf8f4f2027ef80",
  "a5a61717dddc3501cfdf7a4e22d7dbaa",
  "908a6f6a6c131a850ecb0e3f11b08189",
  "3875115bacc48cca24ac51ee4b0e7975",
  "2b0f658cbffd284984fb11d90254081f",
  "b618c3210e934362ac261db280128c22",
  "ae614c557843b1df326cb29c57225459",
  "d43ab110ab2489d6b9b2caa394bf920f",
  "7c4ede33a62160a19586f6e26eaefacf",
  "7fea637fd6d02b8f0adf6f7dc36aed93",
  "4921f95baf824205e1b13f22d60357a1",
  "26751be1181460baf78db8d5eb7aad39",
  "16ba72172e6a4f1de54d11ab6967e371",
  "e721a54a8cf18c8543d44782d9ef681f",
  "b59a51a3c0bf9c5228fde841714f523a",
  "8303a79b1e19a194f1875981be5bdb6f",
  "5d79099fcdf499f12b79770834c0164a",
  "673271cc47c1a4e77f57e239ed4d28a7",
  "ef2a4be5473ab0b3cc286e67b1f59f44",
  "15231a7ce4ba789d13b722cc5c955834",
  "01e00f2f4bfcbb7505cb641066f2859b",
  "9fe97fff97f089661135d0487843108e",
  "5cf21ce30208cfffaa832c6e44bb567d",
  "375c71349b295fbe2dcdca9206f20a06",
  "02f039058bd48307e6f653a2005c9dd2",
  "8bb88f80d334b1869781beb89f7b73be",
  "b9f94c77652c9a76fc8a442748cd54bd",
  "2a27b8144ac02f67687f76782a3b5d8f",
  "a588a6199feff5ba48402883d9b72700",
  "333222170ab9edca4785c39f55221fe7",
  "5bce843dd76db8c939d5323dd3e54ec9",
  "11108a3dbfe4636cb40b84b803b2fff6",
  "c3395dd46c34fa7fd8d729d8cf88b7a8",
  "6351bf9dce654515bf1ddbd6426dfa97",
  "1b36ea1c9b7a1c3ad668b8bb5df7963f",
  "405e28906322882c5be9b4b27f4c35fd",
  "c4de8ced6214345614d33fb0b16a8acd",
  "39dcaf7a053dc372fbc391d4e6b5d693",
  "ea6b2efbdd4255a9f1b3bbc6399b58f4",
  "c59b469d724f7919b7d35514184fdc0f",
  "52d080a3e172c33fd6886a37e7288491",
  "a941493eeea57ede8214fd77d41806bc",
  "5a142a55461d5fef016acfb927fee0bd",
  "a51c896c9cb81ecb5a199d51ac9fc3c5",
  "464d828b85b0bed98e80ade0a5c43b0f",
  "798ed7d4ee7138d49b8828958048130a",
  "0efbe98067c6c73dba1250d2beaa81f9",
  "8b5700012be65c9da25f49408d959ca0",
  "66be31e4c40d676991f2405aaecc6934",
  "fc6709bfdf0572f183c1a84ce5276e96",
  "f3144cefe89a60d6a1afaf7859c5076b",
  "06fe1c234519f6812fc4c1baae25d6af",
  "8e68c3c7bf14ad0bcaba52babfa470bd",
  "f8bf09f5fceaea80e1f864a1b48938bf",
  "2eace51d8f796d04991c831a07059758",
  "130f1a8e9e102707f3f91b010f151b0b",
  "e069ea4c9c233d36ff9c7f329bc08ff1",
  "40b5f25a228570053bc64a043c3f1833",
  "3de568f8597b94bda53149c7d7f5958c",
  "8c8a58fa97c205ff222de3685497742c",
  "e5b294b70c9647dcf804d7baa1903918",
  "8d55a249e6baa5c06772297520da2051",
  "519c84155964659375821f7ca576f095",
  "c5a4e7e6882845ea7bb4d9462868219b",
  "1e4d36177d71bbb3558e43af9577d70e",
  "4afd521d77158e02aed37e2274b90c9c",
  "de73998802680548b916f1947ffbad76",
  "acab0116c354964a558e65bdd07ff047",
  "28dc6b0e1b33769b4b94685e4f4d1e5c",
  "404dcc91b2aeaa7caa47487d1483e48a",
  "8725fb777f25776ffa9076e44fcfd776",
  "515ab26c135e92ed8bf3a594d67e4ade",
  "7137debd45ae4d0ab9aa953017286b20",
  "25e2a30f44898b9f3e978b1786dcd85c",
  "851300ee84c2b80ed40f51ed26d866fc",
  "b29eed44276144e4e8103a661f9a78b7",
  "74563ba21a90da13dacf2a73e3ddefa7",
  "3e7e0224018ab3cf51abb96464d518cd",
  "62889e73828c756c961c5a6d6c01a463",
  "d827f12e35eae370ba9c65b7f6026695",
  "0ae3f79a30234b6c45a6f7d298ba1310",
  "2b45c629e577731c4df84fc34f936a89",
  "46a558d97954d0692411c861cf78ef79",
  "f8c0c968632845cd133308b1a494967f",
  "ffedf5be3a86e2ee281d54cdc97bc1cf",
  "e74c0d42b4433905293aab661fcf8ddb",
  "5103c3584b063c431bd1268e9b5e76fb",
  "1e913e1b06ead0b66e30b6867bf63549",
  "7af6266cc52234b5aa339b16695f7fc4",
  "d5c186983b52c4551ee00f72316c6eaa",
  "fb87582825f9d28a8d42c5e5e5e8b23d",
  "dd055f53a45702fe05e449c30ac80df9",
  "0004d0b59e19461ff126e3a08a814c33",
  "270edd69788dce200a3b395a6da6fdb7",
  "4fa53be91b4933d536748a60458b9797",
  "c4492cbe90fbdbf88a5aec486aa81ed5",
  "ab2b41c63853f0a651ba9fbf502b0cd8",
  "c0d0e461de8d0024aebcb0a7c68836df",
  "a63fc8c5d915e1f1a40f40e6c7499863",
  "231141b34c82aa95e48810a9d1b33a79",
  "d8d31bd778da8bdd536187c36e48892b",
  "d2cdf047a6674cef251d56544a3cf029",
  "cefab442b1728a7c1b49c63f1a55781c",
  "2612aa892d962d6f8056b195ca6e550d",
  "36d7534290610d9b7e9abed244dd2f28",
  "6211080fa89981f66b1a0c9d55c61d0f",
  "eb0ecdb070a1a0ac46de0cd733d39cf3",
  "2d2ca7eedf739ef4c3800713ec482e1a",
  "e6c2dc3dee4a51dcec3a876aa2339a78",
  "7876acb66640bad41f1e1371ef30c180",
  "f976b57bb9dd27aa2e7e7df2825893a6",
  "65fc52ed8f88c81323a418ca94cec2ed",
  "0950ca92a4dcf426067cfd2246bb5ff3",
  "52d2752b150f9c35ccb6869cbf074e48",
  "95e6834d0a3d99e9ea8811855ae9229d",
  "dc513ea4fbdaa7a14786ffdebc4ef64e",
  "b3b4d2dbedc99fe843fd3dedb02f086f",
  "7d2b92b6726c241134dae6cd3fb8c182",
  "4d8556695c262ab91ff51a943fdd6058",
  "38181d991caac98be8fb2ecb8bd0f166",
  "f12f2b34a0c3174269c19e21c07dee68",
  "75455e062929d32a333868084286bb68",
  "fc03d48253286a798f5116ec00e99b2b",
  "b75bd27b5a48a1b48987a18d831f6336",
  "ed277964a8959e72a0d987e598dfbe72",
  "e113bb92c69391dd39e2488f9f588382",
  "9a5748a2fbaa6564d05d7f2ae29a9355",
  "f21e255f89e0f258accbe4e984eef486",
  "c61fbef63df5ff317aecdc3670094472",
  "dd17e652cd2a08fdb8bf7f68e2ad3814",
  "09a5e2a11bea20817477e0b1dfe2cc21",
  "06c284d3f757b15c02f47f3ff06dc275",
  "c60d870eaad6a3946ab3e8734466e532",
  "8cff9bf6694dccfc3b6a613d05d51d16",
  "8e065119c74efe3a47aec8796964cf8b",
  "4de81d9105c85bca6e6e4666e6dd536a",
  "e354fd90b2d5c777bfec87a352a18976",
  "88bfcf02e7f554f9e9ea350b699bc6a7",
  "6f4920ea25403ec77bee9efce43ea25e",
  "f3ac63c91272f19ce97c7397825cc15f",
  "69dafe8b58066478aea48f3d0f384820",
  "52dbb0686f8bd0c0c757acf716e28ec0",
  "db9eeb7e678863649bce209842e0d164",
  "07a4e20a7bbeeb7a736682b26b16ebe8",
  "414e773d5b7e5c06d564f594bf6384d0",
  "139f0874f2ded2e41b0393c4ac5644f7",
  "136f951362dab62e64eb8e841183c2a9",
  "1f36c15d6a3d18d52e8d493bc8187cb9",
  "798cebccb32617ad94123450fd137104",
  "deb54ffb41e085fd7f69a75b6359c989",
  "a82d922b133be19c1171534e6594f754",
  "2d3acd3e240c61820625fff66a19938f",
  "243facb29564e7b448834a7c9d901201",
  "a07c2f3b3b907aaf8436a26c6d77f0a2",
  "df1f1d20ee86704251795841e6a9405a",
  "be6c7b094f88532b6c6b35bbcd525ee8",
  "d5e2c0adad503c91f91df240d0cd4e49",
  "c2ba1bc54b239208cb37b901c0d3b363",
  "ce6c92303f38d297e263c7180f03d402",
  "635440afdfc39fe37995fed127d7df4f",
  "38651c4450f87348fcbe1f992746a954",
  "f6c79f4af478638c39b206ec30ab166b",
  "d6288499d0083cc34e60a077b7c4b3e1",
  "2b8eba3cb0d0f1d761cb74d94a5ace36",
  "53ed35c74a2ec275b837374f04396c03",
  "a11f9e533f28593768ebf87075ab34f2",
  "b5f1e8fb36cd7fbeb7988e8639ac79e9",
  "68d309812548887400e375eaa036d2f1",
  "778609db5dc7e1a8315717a9cdd8fd6f",
  "2d405b367158e3f12d7c1e31a96b3af3",
  "426f990b332ef8193a61cc90516c1245",
  "f35a2bc72dfdc2aae569a0c7370bd7f5",
  "a7789ef88d599b8df86bbee632b2994d",
  "f2e43fa3400d826df4195a9ac70dca62",
  "d8bf84be3800d12f74d8b05e9b89836f",
  "4e0cb6fb5fb446d1c92ede2ed8780188",
  "6cfe0e6127fa25df2a0ef2ae1067d915",
  "8f468c873a32bb0619eaeb2050ba45d1",
  "e744f91c29ec99f0e662c9177946c627",
  "cc1aa436277138f61cda703991069eaf",
  "2ab56412b1163ee131e1246da0955bd1",
  "c32d9bf27a3da7ec8163957080c8628e",
  "d79aac075930c83c2f1e369a511148fe",
  "d93ed5b6db83be78efb0d05ae420158e",
  "f73b76ce8949fe29bf2a537cfa420e8f",
  "28f0b864598a1291557bed248a998d4e",
  "70c639df5e30bdee440e4cdf599fec2b",
  "1543843a4723ed2ab08e18053ae6dc5b",
  "f8c1f23d6a8d8d7904fc0ea8e066b3bb",
  "0deb1c54814305ca9ad266f53bc82511",
  "5a4b25aaed25c2ee1b74de72dc03c14e",
  "149815eb972b3c370dee3b89d645ae14",
  "e0688d13958a19e087e123148555e4b4",
  "761c7920f470038d4c8a619c79eddd62",
  "a70dc40477bc2adceef4d2c90f47eb82",
  "1680e9fa7b4dd5d62ece800239bb53bd",
  "228bbc2f87caeb21bb7f6949fddcb91d",
  "148260a1ce4fe4907df4cd475c442e28",
  "30f8f6b940d1073d8b6a5eebc46dd6e5",
  "eb06b9db06012a7a4179b8f3cb5384d3",
  "0b7e926154c1274e8b602ff0d7c133d7",
  "66808e327dc79d135ba18e051673d906",
  "42e7aaa88b48137a16a1acd04ed91125",
  "8fe0093bb30d6f8c31474bd0764e6ac0",
  "41ae36ecb9b3eee609d05b90c14222fb",
  "d1f255a373a3cef72e03aa9d980c7eca",
  "fccb60fb512d13df5083790d64c4d5dd",
  "1651cf0d2f737d7adeab84d339dbabd3",
  "eed5af6add95a9a6f1252739b1ad8c24",
  "a8abb4bb284b5b27aa7cb790dc20f80b",
  "15d4e891d784977cacbfcbb00c48f133",
  "c203d8a151612acf12457e4d67635a95",
  "7fe1f8abaad094e0b5cb1b01d712f708",
  "03255088ed63354a54e0e5ed957e9008",
  "7180cffd6a8e829dacfc2a31b3f72ece",
  "6c97cd07663b099253bc569fe8d342bb",
  "d5e2fbef30a4eb668a203060ec8e5eef",
  "1b9812b99fe2672af746cefda86be5f9",
  "f1e2b2c9255d552500a833ac828cd635",
  "69d658d0b2859e32cd4dc3b970c8496c",
  "d1dc3a8270a6f9394f88847d7f0050cf",
  "e9fd7c2c6623306db59b6aef5c0d5cac",
  "71a58e8cb75904f24cde464161c3e766",
  "962e56a8a0b0420d87272a682bfd1e53",
  "3de2334a314a7a72721f1f74a6cb4cee",
  "e11943a6031a0e6114ae69c257617980",
  "8fb21ee7a2207526da55a679f0332de2",
  "ad71c82b22f4f65b9398f76d8be4c615",
  "98b297950041a42470269d56260243a1",
  "0353ab4cbed5beae847a7ff6e220b5cf",
  "51d92be1c60d1db1d2e5e7a07da55b26",
  "428fca9bc1921c25c5121f9da7815cde",
  "f1b6f2857fb6d44dd73c7041e0aa0f19",
  "e1e32e235eee1f970470a3a6658dfdd5",
  "eba0dc302bcd9a273f8bbb72be3a687b",
  "218a0aefd1d1a4be65601cc6ddc1520e",
  "7d04bbbe5494ae9d2f5a76aa1c00fa2f",
  "a516a87cfcaef229b342c437fe2b95f7",
  "c3c59e5f8b3e9753913f4d435b53c308",
  "e8c0653fea13f91bf3c48159f7c24f78",
  "273448411df1962cba1db6c05b3213c9",
  "7cf64379eb6f29a4d25c4b6a2df713e4",
  "be53d253d6bc3258a8160556dda3e9b2",
  "fd69dbe29f156a7ef876a40a94f65599",
  "54b2b21af94108d83c2a909d5b0a6a50",
  "619205da514e83f869515c782a328d3c",
  "dc960c46c38bd16e953d97cdeefdbc68",
  "fd5c905bcd8c3348ad1b35d7231ee2b1",
  "71f6278d140af599e06ad9bf1ba03cb0",
  "d759175de8ea5b1d9a2660e45554894f",
  "b7087c1f4f89e63af8d46f3b20271153",
  "56468d5607a5aaf1604ff5e15593b003",
  "e94f63f579e05cb49c05c2d050ead9c0",
  "c913303f392ffc643f7240b180602652",
  "ff4d5fbbafdf976cfdc032e3bde78de5",
  "2d6cc4b2d139a53512fb8cbb3086ae2e",
  "389bc7bb1e1c2a5e7e147703232a88f6",
  "087408522c31eeb1f982bc0eaf81d35f",
  "a760880003e7ddedfef56acb3b09697f",
  "f4be00279ee2e0a53eafdaa94a151e2c",
  "37f0e884fbad9667e38940169d0a3c95",
  "d64a340bcb633f536d56e51874281454",
  "0fcbc61acd0479dc77e3cccc0f5ffca7",
  "298f95e1bf9136124592c8d4825a06fc",
  "df877f3865752637daa540ea9cbc474f",
  "c399862d3b9d6b76c8436e924a68c45b",
  "7f24d240521d99071c93af3917215ef7",
  "e2230b853516e7b05d79744fbd4c9c13",
  "7b4773c039d539af17c883eb9283dd14",
  "e9412ee564384b987d086df32d4ce6b7",
  "f7e0b956540676a129760a3eae309294",
  "e77dbaf6759253c7c6d0efc5690369c7",
  "10c66082c124f8afe3df4886f5e516e0",
  "7e3b7a5bafcb0fa8e8dfe3ea6aca9186",
  "bb7946e7d85c81a9e69fee1cea4a087c",
  "7940ab47468396569a906f75ff3f20ef",
  "459a4ddcb586f24efd9395aa7662bc7c",
  "ab1a4d0dd4d48a2ba1077c4494791306",
  "46771d1f432b42343f56f791422a4991",
  "b069b3415151fa7217e870017374de7c",
  "2dffbc474aa176b6dc957938c15d0c8b",
  "372d3f309fef061977fb2f7ba36d74d2",
  "35936504a37d53e03abdfbc7318d9ec7",
  "dbd22ba3bd0df8f385bdac3e9f8be207",
  "806fec5af7f5b48b8a31a003e171f3fb",
  "a3eb043e7bf775de87763e9f8121c953",
  "1e0a84051e6a4a7381473328f43c4884",
  "b6cda17abb967ed28ec9610137aa45f7",
  "c70daf247944fe3add32218f914c75a6",
  "f93882cbd8fc7fb794c1011d63be6fb6",
  "7c82fab8c8f89124e2ce92984e04fb40",
  "995665640dc319973d3173a74a03860c",
  "7b5b23f4aadf9513306bcd59afb6e4c9",
  "7895fc13088ee37f511913bac71fa66f",
  "c5cc17e395d3049b03e0f1ccebb02b4d",
  "0245952ecff55018e2a459517fdb40e3",
  "7cc532d783a7461f227a5da8ea80bfe1",
  "8169e05e2a0debcb15458f2cc1eff0ea",
  "c8dfece5cc68249206e4690fc4737a8d",
  "43e4e6a6f341e00671e123714de019a8",
  "e82c4b19b8151ddc25d4d93baf7b908f",
  "2321994d85d661d792223f647000c65f"
]
